NameError: name 'encode' is not defined while trying to format an object to json. I have an issue if